# -*- coding: utf-8 -*-
#!/usr/bin/env python3
import socket

IP='127.0.0.1'
PORT=8888

def server():
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.bind((IP, PORT))
        s.listen()
        conn,addr=s.accept() # 建立连接
        # 数据处理
        with conn:
            print(addr)
            while True:
                data = conn.recv(1024)
                print(data)
                if not data:
                    break
    return

server()